package reflect;


import java.lang.reflect.Constructor;

public class Test {
    public static void main(String[] args) throws Exception {
        Class cls= Class.forName("reflect.Student");
        Constructor constructor = cls.getConstructor();
        Object obj1 = constructor.newInstance();
        System.out.println(obj1);

        Object obj = cls.newInstance();//无参构造器实例化对象
        System.out.println(obj);

        Constructor c =cls.getConstructor(String.class,int.class,char.class);
        Object obj2 = c.newInstance("张三",30,'男');
        System.out.println(obj2);


    }
}
